Skip to main content

Import

Usage

Data Hooks

The SDK provides specialized hooks to fetch and format data for the CollectibleCard component:

Market Cards

Shop Cards

For shop cards, there are two hooks based on the contract type:
These hooks handle:
  • Data fetching and formatting
  • Loading states
  • Pagination (for market cards)
  • Type-specific data requirements
  • Integration with filters and search

Examples

Example of using the CollectibleCard component in a marketplace context:

Parameters

The component accepts different props based on the marketplace type:

Base Props

These properties are shared by all card types:

Shop Card Props

Additional properties for shop cards (marketplaceType="shop"):

Market Card Props

Additional properties for market cards (marketplaceType="market"):

Features

Card Variants

The component supports two main variants:
  1. Market Card: Used for displaying collectibles in a marketplace context with:
    • Current listing price
    • Highest offer indicator
    • Balance/ownership information
    • Buy/Offer actions
  2. Shop Card: Used for primary sales with:
    • Sale price
    • Supply information
    • Sale status
    • Purchase actions

Automatic Type Detection

The component automatically handles different token standards:
  • ERC-721 (Non-fungible tokens)
  • ERC-1155 (Semi-fungible tokens)

Loading States

Built-in loading states are provided:

Price Formatting

The component includes sophisticated price formatting with:
  • Currency symbol display
  • Overflow/underflow indicators
  • Support for various token decimals
  • “Free” indicator for zero prices

Integration Examples

Market Content Integration

Here’s a complete example of integrating the CollectibleCard in a marketplace context:

Shop Content Integration

Example of integrating the CollectibleCard in a shop context with contract type handling:

Notes

The MarketplaceCollectibleCard component is designed to handle various marketplace scenarios with:
  • Responsive layout
  • Loading states
  • Price formatting
  • Supply tracking
  • Action handling
  • Owner-specific features
  • Offer management
When using with ERC-1155 tokens, note that:
  • Balance is displayed as “Owned: X” format
  • Supply information is shown for shop items
  • Quantity tracking is supported

Best Practices

  1. Data Fetching
    • Use the appropriate data hook based on your context (market/shop) and contract type (ERC721/ERC1155)
    • Enable conditional fetching using the enabled prop when necessary
    • Handle loading states appropriately
  2. Event Handling
    • Implement click handlers for both the card and specific actions (buy, offer)
    • Use the onCannotPerformAction callback to handle unauthorized actions
  3. Display
    • Wrap cards in buttons for clickable behavior
    • Use appropriate className for layout and spacing
    • Consider implementing infinite scroll or pagination for large collections